import axios from 'axios'

const api = axios.create({
  baseURL: 'http://localhost:3000/api',
  timeout: 5000
})

// 客户管理API
export const customerAPI = {
  getAll: (keyword = '') => api.get('/customers', { params: { keyword } }),
  create: (data) => api.post('/customers', data),
  update: (id, data) => api.put(`/customers/${id}`, data),
  delete: (id) => api.delete(`/customers/${id}`)
}

// 图书管理API
export const bookAPI = {
  getAll: (keyword = '') => api.get('/books', { params: { keyword } }),
  create: (data) => api.post('/books', data),
  update: (id, data) => api.put(`/books/${id}`, data),
  delete: (id) => api.delete(`/books/${id}`)
}

// 文创产品API
export const productAPI = {
  getAll: (keyword = '') => api.get('/products', { params: { keyword } }),
  create: (data) => api.post('/products', data),
  update: (id, data) => api.put(`/products/${id}`, data),
  delete: (id) => api.delete(`/products/${id}`)
} 